package TeamR3.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import TeamR3.dao.OrderDao;
import TeamR3.entity.Order;
import TeamR3.entity.Room;


@Repository("orderDao")
public  class OrderDaoImpl implements OrderDao{


	@Autowired
	private SqlSessionTemplate sst = null;
	private Object order;
	private Object room_status;
	
	
	public SqlSessionTemplate getSst() {
		return sst;
	}

	public void setSst(SqlSessionTemplate sst) {
		this.sst = sst;
	}

	@Override
	public List<Order> queryOrderbook() {
		// TODO Auto-generated method stub
		List<Order> list = sst.selectList("getOrderByCondition", order);
		return list;
	}

	@Override
	public int addOrder(Order order) {
		// TODO Auto-generated method stub
		
			int result = sst.insert("addOrder", order);
			sst.commit();
			return result;
	
	
	}

	@Override
	public int modifyOrderbook(Order order) {
		// TODO Auto-generated method stub
		int result = sst.update("modifyOrderbook", order);
		sst.commit();
		return result;
	}

	@Override
	public int changeOrderbook(int order_status) {
		// TODO Auto-generated method stub
		int result = sst.update("changeOrderbook", order_status);
		sst.commit();
		return result;

	}

	@Override
	public List<Room> checkRoom(String room_type) {
		// TODO Auto-generated method stub
		List<Room> list= sst.selectList("checkRoom", room_status);
		return list;
	}
}
